---

title: Use DataRobot Prime with AWS Lambda
description: Use DataRobot Prime to download a DataRobot model and deploy it using AWS Lambda.
---

# Use DataRobot Prime models with AWS Lambda {: #use-datarobot-prime-models-with-aws-lambda }

!!! info "Availability information"
    The ability to create _new_ DataRobot Prime models has been removed from the application. This does not affect _existing_ Prime models or deployments. To export Python code in the future, use the Python Scoring Code export function in any RuleFit model.


This page outlines how you can use the DataRobot Prime model functionality to download a DataRobot model and deploy it using AWS Lambda.

DataRobot Prime can be initiated on most DataRobot models and allows you to download an approximation of a DataRobot model either as a Python or Java module.
The code is then easily deployable in any environment and is not dependent on the DataRobot application.
Before proceeding with this workflow, be sure to download a DataRobot Prime model as a Java module.

## Why deploy on AWS Lambda {: #why-deploy-on-aws-lambda }

While DataRobot provides its own scalable prediction servers that are fully integrated with the platform, there are multiple reasons why you would want to deploy on AWS Lambda:

* Company policy or governance decision.

* Serverless architecture.

* Cost reduction.

* Custom functionality on top of the DataRobot model.

* The ability to integrate models into systems that cannot communicate with the DataRobot API.

## Setup {: #setup }

Follow the steps below to complete setup for this example.

1. Rename the Java file to `Prediction.java`.

2. Create a project, “lambda_prime_example”, in the IDE of your choice.

3. Copy `Prediction.java` to the project.

    ![](images/int_udpmwal_large.png)

4. Compile the package using the `mvn package` command.

5. Click **Create function** to create a new AWS function.

    ![](images/int_udpmwal_large_005.png)

6. Choose Java 11 to create Lambda.

    ![](images/int_udpmwal_large_008.png)

7. Give the function a name and choose the permissions.

    ![](images/int_udpmwal_large_007.png)

8. Upload the compiled JAR file to Lambda.

    ![](images/int_udpmwal_large_006.png)

9. Change the Lambda handler to the name of the Java package method:

    ```
    com.datarobot.examples.scoring.prime.PrimeLambdaExample::handleRequest
    ```

Setup is now complete. Next, perform testing to verify that the deployment is working as intended.

## Test the Lambda function {: #test-the-lambda-function }

To test the Lambda function:


1. Go to the TEST event configuration page.

    ![](images/int_udpmwal_large_002.png)

2. Put JSON with features as test event:

    ![](images/int_udpmwal_large_003.png)

3. Click the **Test** button.

    ![](images/int_udpmwal_large_004.png)

Now, you can configure the integration with an AWS API Gateway or other services so that data is sent to the Lambda function and you receive results back.
